import { createRouter, createWebHashHistory } from "vue-router";
import Home from "../views/Home/Home.vue";
// 静态路由
export const constantRoutes: any[] = [
  {
    path: "/",
    redirect: "/Home",
  },
  {
    name: "Home",
    path: "/home",
    component: Home,
    children: [
      {
        name: "Chat",
        path: "/home/chat",
        component: () => import("../views/Chat/Chat.vue"),
      },
      {
        name: "Friend",
        path: "/home/friend",
        component: () => import("../views/Friend/Friend.vue"),
      },
      {
        name: "Group",
        path: "/home/group",
        component: () => import("../views/Group/Group.vue"),
      },
    ],
  },
];
export const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
  // 刷新时，滚动条位置还原
  scrollBehavior: () => ({ left: 0, top: 0 }),
});
export default router;
